package jee.boot.entity.system;

import jee.boot.common.annotation.Column;
import jee.boot.common.annotation.Table;
import jee.boot.common.basic.DataEntity;
import jee.boot.common.utils.HttpServletHolder;

/**
 * 系统消息码
 * 200 :正常
 * 10000-19999: 系统内置的错误消息码,业务不可使用
 * 20000+ :业务错误消息码,根据业务需要自由发挥
 */
@Table(name = "st_message_code")
public class MessageCode extends DataEntity<MessageCode> {
    /**
     * 消息码
     */
    private Integer code = 200;
    /**
     * 消息类型
     */
    private String type;
    /**
     * 国际语言代码
     */
    private String i18nCode;
    /**
     * 国际语言
     */
    @Column(action = Column.Action.QUERY, key = "code", name = "i18n_code",data = {"i18n.id","i18n.code","i18n.label"},extraConditions = {"i18n.language=#{language}"})
    private I18n i18n;


    public MessageCode() {
    }

    public MessageCode(String id) {
        super(id);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public I18n getI18n() {
        return i18n;
    }

    public void setI18n(I18n i18n) {
        this.i18n = i18n;
    }

    public String getI18nCode() {
        return i18nCode;
    }

    public void setI18nCode(String i18nCode) {
        this.i18nCode = i18nCode;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public static void main(String[] args) {
        MessageCode messageCode= new MessageCode();
        messageCode.addFilter(new Filter("code","=","500"));
        System.out.println(messageCode.getFindListSql()+" where "+messageCode.getWhere());
    }
}
